package com.edu.utils;

import com.edu.entity.User;
import com.edu.service.user.UserService;
import com.edu.service.user.UserServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;

/**
 * @author ZCN
 * @version 1.0
 * @date 2021/11/24 9:10
 */
public class GetLoginUser {
    private static UserService userService = new UserServiceImpl();
    public static User getUser(HttpServletRequest req) throws SQLException {
        String username =(String) req.getSession().getAttribute("username");
        return userService.selectByUsername(username);
    }
}
